package com.ktjy.test;

import cn.printer.Printer;
import com.ktjy.entity.Employee;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author 黄军艳
 * @version 1.0
 * @date 2024/12/2  10:37
 */
public class Main {
    @Test
    public void test1() {
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        Employee employee=(Employee)context.getBean("emp1");
        Employee employee2=(Employee)context.getBean("emp2");
        employee.info();
        employee2.info();
    }

    @Test
    public void test2() {
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        Employee employee=(Employee)context.getBean("emp3");
        Employee employee2=(Employee)context.getBean("emp4");
        employee.info();
        employee2.info();
    }

    @Test
    public void test3(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        Printer printer=(Printer) context.getBean("printer");
        printer.print("rdfghjkl;'fcghujikogvhjgvhjhj");
    }

    @Test
    public void test4(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        Printer printer=(Printer) context.getBean("printer2");
        printer.print("rdfghjkl;'fcghujikogvhjgvhjhj");
    }

    @Test
    public void test5(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        Printer printer2=(Printer) context.getBean("printer3");
        printer2.print("wedrfgbhn");
    }
}
